<div id="project_<%= project.name %>" class="project build_<%= project.last_complete_build_status %>">
<table class="project_pane">
<tr>

  <td class="project_summary">

    <div>
      <span class="project_name">
        <%= link_to project.name, :action => 'show', :id => project.name %>
      </span>
    </div>

    <div class="recent_builds">

      <% recent_builds = project.last_five_builds %>

      <span class="lead">
        <%= recent_builds.first ? 'build ' : '<span class="build_status">Never built</span>' %>
        <br/>
        <%= link_to image_tag('rss_light.gif'), :action => 'show', :id => project.name, :format => 'rss' %>
      </span>

      <% unless recent_builds.empty? %>
        <div class="builds_list">
          <% recent_builds.each do |build| %>
            <% if build == recent_builds.first %>
                <div class="build_summary"><%= link_to_build_with_elapsed_time(project, build) %></div>
            <% else %>
                <div class="build_summary"><%= link_to_build(project, build) %></div>
            <% end %>
          <% end %>
        </div>
      <% end %>
    </div>
  </td>

  <td class="builder_control">
    <div class="buttons">
      <% form_remote_tag(
             :url => { :action => 'build', :id => project },
             :before => "$('build_#{project.to_param}').disabled = true; " +
                        "$('build_#{project.to_param}').className = 'build_button_disabled'; " +
                        "Element.update('build_#{project.to_param}', 'Wait...')"
           ) do %>
        <div>
          <button 
              <% if Configuration.disable_build_now -%>
                onclick="alert('Build Now button is disabled on this site.'); return false;"
              <% end -%>
                id="build_<%= project.to_param %>" type="submit" class="build_button" value="txt" title="Build Now">
            <% if project.builder_state_and_activity == 'builder_down' %>
              Start Builder
            <% else %>
              Build Now
            <% end %>
          </button>
        </div>
      <% end %>
    </div>
    <%= display_builder_state(project.builder_state_and_activity) %>
  </td>

  <td class="build_details">
    <% latest_build = recent_builds.first %>
    <% if latest_build %>
      <% if latest_build.incomplete? %>
        <div>
          Now building: <%= latest_build.label %>
          for <%= format_seconds(latest_build.elapsed_time_in_progress, :general) %>
        </div>
      <% end %>
      <%= show_revisions_in_build(revisions_in_build(latest_build)) %>
      <br />
      <% if latest_build.brief_error %>
        <div><%= link_to latest_build.brief_error, {:action => 'show', :id => project.name}, {:class => "failed"} %></div>
      <% end %>
      <div class="error_message"><%= simple_format(project.builder_error_message) %></div>
    <% end %>   
  </td>
</tr>
</table>
</div>
